import Vue from 'vue' // 引入vue
function changeStr(str){
    //return str.charAt(0).toUpperCase() + str.slice(1) //处理首字母大写 abc => Abc
    return str.toUpperCase(); //处理首字母大写 abc => ABC
}
const requireComponent = require.context('./charts', true, /index\.vue$/)
//console.log('requireComponent.keys():',requireComponent.keys())  
requireComponent.keys().forEach(fileName => {
    const config = requireComponent(fileName)
    const componentName = changeStr(
        fileName.replace(/^\.\//, '').replace(/\.\w+$/, '')   // ./back.vue => BACK
    )
    //console.log(config.default.name)
    Vue.component(config.default.name||componentName, config.default || config) // 动态注册该目录下的所有index.vue文件
})